using Newtonsoft.Json;

namespace test_newtonsoft.Extenteds
{
    public static class TypeConvert
    {
        public static T Convert<T>(this object initObject)
        {
            var jsonStr = JsonConvert.SerializeObject(initObject, Formatting.Indented);
            var resObject = JsonConvert.DeserializeObject<T>(jsonStr, new JsonSerializerSettings
            {
                
            });
            // Console.WriteLine(resObject);
            return resObject;
        }

        public static T ConvertObject<T>(this string jsonStr)
        {
            var resObject = JsonConvert.DeserializeObject<T>(jsonStr, new JsonSerializerSettings
            {

            });
            return resObject;
        }
    }
}